<?php
// +---------------------------------------------------------------
// | Package: Tommy Framework
// +---------------------------------------------------------------
// | Version $Id: Db.class.php 2010-3-30 12:30:30 $
// +---------------------------------------------------------------
// | Copyright (c) 2009 http://www.tommyframework.com All rights reserved.
// +---------------------------------------------------------------
// | Author: tommy <service@tommyframework.com>
// +---------------------------------------------------------------

if(!defined('IN_TOMMY')){
	exit;
}
class Db extends Base{
	
	/**
     +----------------------------------------------------------
     * 利用工厂模式对数据库操作类进行初始化.
     +----------------------------------------------------------
     * @access public
     +----------------------------------------------------------
     * @return object
     +----------------------------------------------------------
     */
	public function factory($params){
		if($params['driver']){
			if($params['driver']=='mysql'){
				$link_id = Db_Mysqli::getInstance($params);
			}else {
				$link_id = Db_Pdo::getInstance($params);
			}		
		}else{
			$link_id = Db_Mysqli::getInstance($params);
		}		
		return $link_id;
	}		
}
?>